home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / FAREALOC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  648 b   |  26 lines

  1. /* farealoc.c --- p. 134 */
  2. # include <stdio.h>
  3. # include <alloc.h>
  4. main()
  5. {
  6.     int far *block1, *block2;
  7.     if((block1 = farmalloc(1000L)) == NULL)
  8.     {
  9.         printf("Block1 allocation failed!\n");
  10.         exit(1);
  11.     }
  12.     printf("First block of 1,000 bytes allocated at %Fp\n",block1);
  13.     if((block2 = farmalloc(100L)) == NULL)
  14.     {
  15.         printf("Block2 allocation failed!\n");
  16.         exit(1);
  17.     }
  18.     printf("Second block of 100 bytes allocated at %Fp\n",block2);
  19.     if((block1 = farrealloc(block1, 80000L)) == NULL)
  20.     {
  21.         printf("Block1 allocation failed!\n");
  22.         exit(1);
  23.     }
  24.     printf("Size of first block adjusted to 80,000 bytes at %Fp\n",
  25.                                 block1);
  26. }